package main

import (
	"fmt"
	"os"
	"time"
)

func main()  {
	newProcess()
}

func newProcess(){
	process, _ := os.StartProcess("/usr/bin/php", []string{"php","-f","./test.php"}, &os.ProcAttr{
		Files: []*os.File{os.Stdin,os.Stdout,os.Stderr},
	})
	fmt.Println(process)
	findProcess, _ := os.FindProcess(process.Pid)
	fmt.Println(findProcess)
	time.AfterFunc(10 * time.Second, func() {
		process.Signal(os.Kill)
	})
	state, _ := process.Wait()  // 等待进程结束
	fmt.Println(state.String())
}